'''
Created on Aug 11, 2012

@author: peng
'''
import datetime
import sys
import os

if __name__ == '__main__':
    datetime.datetime.utcfromtimestamp(1348211042).strftime("%Y-%m-%d")
    in_file = open(sys.argv[1])
    strat_time = int(sys.argv[2]) * 1000
    stop_time = int(sys.argv[3]) * 1000

    file_path = os.path.dirname(os.path.abspath(__file__))
    out_file = open(os.path.join(file_path, sys.argv[1] + '_out.log'), 'w')

    for l in in_file.readlines():
        line_list = l.split('\t')
        if len(line_list) < 24:
            print l
            continue
        t = int(line_list[24])
        if strat_time < t < stop_time:
            out_file.write(l)
            out_file.write('\n')

    in_file.close()
    out_file.close()
